# 导入flask类
from flask import Flask,request,make_response
#注册蓝图






#导入sqlalchemy
# from flask_sqlalchemy import SQLAlchemy
# from flask_migrate import Migrate,MigrateCommand, migrate
# from flask_script import Manager,Shell



# 初始Flask
app = Flask(__name__)


from news import news
#注册蓝图
app.register_blueprint(news,url_prefix='/news')



# 加载配置文件
from config import Config
app.config.from_object(Config)


# 实例化一个数据库类
# db = SQLAlchemy(app)
# manage=Manager(app)
# migrate=Migrate(app)






# 全局配置跨域
from flask_cors import CORS
cors = CORS(app)


#添加展示
@app.route('/index/',methods=['POST','GET'])
def index():
    #判断请求 是否是post
    if request.method =='POST':
        #添加
        # 接受请求的参数
        username = request.form.get("username")
        #返回
        return username
    else:
        #展示
        # 接受请求的参数
        userid = request.args.get("userid")
        #返回
        return userid








#调用实例化类
if __name__ == '__main__':
    app.run()
    






